﻿
namespace MyApp.Domain.DomainServices
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using MyApp.Data.Model;
    using ServerFramework.Domain;


    // Implements application logic using the MyAppEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class MyAppService : DomainRepositoryService<MyAppEntities>
    {

        #region Customer

        public IQueryable<Customer> GetCustomers()
        {
            return base.GetQuery<Customer>();
        }

        public void InsertCustomer(Customer entity)
        {
            base.Insert(entity);
        }

        public void UpdateCustomer(Customer entity)
        {
            base.Update(entity);
        }

        public void DeleteCustomer(Customer entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region Department

        public IQueryable<Department> GetDepartments()
        {
            return base.GetQuery<Department>();
        }

        public void InsertDepartment(Department entity)
        {
            base.Insert(entity);
        }

        public void UpdateDepartment(Department entity)
        {
            base.Update(entity);
        }

        public void DeleteDepartment(Department entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region Employee

        public IQueryable<Employee> GetEmployees()
        {
            return base.GetQuery<Employee>();
        }

        public void InsertEmployee(Employee entity)
        {
            base.Insert(entity);
        }

        public void UpdateEmployee(Employee entity)
        {
            base.Update(entity);
        }

        public void DeleteEmployee(Employee entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region Order

        public IQueryable<Order> GetOrders()
        {
            return base.GetQuery<Order>();
        }

        public void InsertOrder(Order entity)
        {
            base.Insert(entity);
        }

        public void UpdateOrder(Order entity)
        {
            base.Update(entity);
        }

        public void DeleteOrder(Order entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region OrderDetail

        public IQueryable<OrderDetail> GetOrderDetails()
        {
            return base.GetQuery<OrderDetail>();
        }

        public void InsertOrderDetail(OrderDetail entity)
        {
            base.Insert(entity);
        }

        public void UpdateOrderDetail(OrderDetail entity)
        {
            base.Update(entity);
        }

        public void DeleteOrderDetail(OrderDetail entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region Product

        public IQueryable<Product> GetProducts()
        {
            return base.GetQuery<Product>();
        }

        public void InsertProduct(Product entity)
        {
            base.Insert(entity);
        }

        public void UpdateProduct(Product entity)
        {
            base.Update(entity);
        }

        public void DeleteProduct(Product entity)
        {
            base.Delete(entity);
        }

        #endregion

        #region ProductCategory

        public IQueryable<ProductCategory> GetProductCategories()
        {
            return base.GetQuery<ProductCategory>();
        }

        public void InsertProductCategory(ProductCategory entity)
        {
            base.Insert(entity);
        }

        public void UpdateProductCategory(ProductCategory entity)
        {
            base.Update(entity);
        }

        public void DeleteProductCategory(ProductCategory entity)
        {
            base.Delete(entity);
        }

        #endregion
    }
}


